import 'package:nyh_motorcade_app/entity/vehicle_info_entity.dart';

vehicleInfoEntityFromJson(VehicleInfoEntity data, Map<String, dynamic> json) {
	if (json['page'] != null) {
		data.page = json['page'] is String
				? int.tryParse(json['page'])
				: json['page'].toInt();
	}
	if (json['pageSize'] != null) {
		data.pageSize = json['pageSize'] is String
				? int.tryParse(json['pageSize'])
				: json['pageSize'].toInt();
	}
	if (json['total'] != null) {
		data.total = json['total'] is String
				? int.tryParse(json['total'])
				: json['total'].toInt();
	}
	if (json['totalPage'] != null) {
		data.totalPage = json['totalPage'] is String
				? int.tryParse(json['totalPage'])
				: json['totalPage'].toInt();
	}
	if (json['item'] != null) {
		data.item = (json['item'] as List).map((v) => VehicleInfoItem().fromJson(v)).toList();
	}
	return data;
}

Map<String, dynamic> vehicleInfoEntityToJson(VehicleInfoEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['page'] = entity.page;
	data['pageSize'] = entity.pageSize;
	data['total'] = entity.total;
	data['totalPage'] = entity.totalPage;
	data['item'] =  entity.item?.map((v) => v.toJson())?.toList();
	return data;
}

vehicleInfoItemFromJson(VehicleInfoItem data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'].toString();
	}
	if (json['createTime'] != null) {
		data.createTime = json['createTime'].toString();
	}
	if (json['createUser'] != null) {
		data.createUser = json['createUser'].toString();
	}
	if (json['createUserId'] != null) {
		data.createUserId = json['createUserId'].toString();
	}
	if (json['updateTime'] != null) {
		data.updateTime = json['updateTime'].toString();
	}
	if (json['updateUser'] != null) {
		data.updateUser = json['updateUser'].toString();
	}
	if (json['updateUserId'] != null) {
		data.updateUserId = json['updateUserId'].toString();
	}
	if (json['createEmpno'] != null) {
		data.createEmpno = json['createEmpno'];
	}
	if (json['updateEmpno'] != null) {
		data.updateEmpno = json['updateEmpno'];
	}
	if (json['headquarterGroupId'] != null) {
		data.headquarterGroupId = json['headquarterGroupId'].toString();
	}
	if (json['vehicleNumber'] != null) {
		data.vehicleNumber = json['vehicleNumber'].toString();
	}
	if (json['type'] != null) {
		data.type = json['type'].toString();
	}
	if (json['typeName'] != null) {
		data.typeName = json['typeName'].toString();
	}
	if (json['belongToType'] != null) {
		data.belongToType = json['belongToType'].toString();
	}
	if (json['belongToTypeName'] != null) {
		data.belongToTypeName = json['belongToTypeName'].toString();
	}
	if (json['status'] != null) {
		data.status = json['status'] is String
				? int.tryParse(json['status'])
				: json['status'].toInt();
	}
	if (json['motorcadeId'] != null) {
		data.motorcadeId = json['motorcadeId'].toString();
	}
	if (json['motorcadeName'] != null) {
		data.motorcadeName = json['motorcadeName'].toString();
	}
	if (json['remake'] != null) {
		data.remake = json['remake'].toString();
	}
	if (json['refuelQuota'] != null) {
		data.refuelQuota = json['refuelQuota'] is String
				? double.tryParse(json['refuelQuota'])
				: json['refuelQuota'].toDouble();
	}
	if (json['remainQuota'] != null) {
		data.remainQuota = json['remainQuota'] is String
				? double.tryParse(json['remainQuota'])
				: json['remainQuota'].toDouble();
	}
	if (json['circle'] != null) {
		data.circle = json['circle'].toString();
	}
	if (json['unit'] != null) {
		data.unit = json['unit'].toString();
	}
	if (json['subCompanyList'] != null) {
		data.subCompanyList = (json['subCompanyList'] as List).map((v) => v.toString()).toList().cast<String>();
	}
	if (json['isSelect'] != null) {
		data.isSelect = json['isSelect'];
	}
	if (json['bindingVehicle'] != null) {
		data.bindingVehicle = json['bindingVehicle'];
	}
	return data;
}

Map<String, dynamic> vehicleInfoItemToJson(VehicleInfoItem entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['createTime'] = entity.createTime;
	data['createUser'] = entity.createUser;
	data['createUserId'] = entity.createUserId;
	data['updateTime'] = entity.updateTime;
	data['updateUser'] = entity.updateUser;
	data['updateUserId'] = entity.updateUserId;
	data['createEmpno'] = entity.createEmpno;
	data['updateEmpno'] = entity.updateEmpno;
	data['headquarterGroupId'] = entity.headquarterGroupId;
	data['vehicleNumber'] = entity.vehicleNumber;
	data['type'] = entity.type;
	data['typeName'] = entity.typeName;
	data['belongToType'] = entity.belongToType;
	data['belongToTypeName'] = entity.belongToTypeName;
	data['status'] = entity.status;
	data['motorcadeId'] = entity.motorcadeId;
	data['motorcadeName'] = entity.motorcadeName;
	data['remake'] = entity.remake;
	data['refuelQuota'] = entity.refuelQuota;
	data['remainQuota'] = entity.remainQuota;
	data['circle'] = entity.circle;
	data['unit'] = entity.unit;
	data['subCompanyList'] = entity.subCompanyList;
	data['isSelect'] = entity.isSelect;
	data['bindingVehicle'] = entity.bindingVehicle;
	return data;
}